<script>
<!--
var contact_dialog = null;

function contact_dialog_submit()
{
    contact_dialog_close();

    $.post(
        '<?php echo url_for('@contact_message') ?>',
        $('#contact_form').serialize(),
        function (data) {
            if (data.status === 'missing_message') {
                var contact_dialog = new fss.Dialog({
                    title: <?php echo json_encode(__('Error')) ?>,
                    message: <?php echo json_encode(__('You must enter a message.')) ?>,
                    cancel: <?php echo json_encode(__('Close')) ?>
                });
            } else {
                var contact_dialog = new fss.Dialog({
                    title: <?php echo json_encode(__('Confirmation')) ?>,
                    message: <?php echo json_encode(__('Your email has been delivered.')) ?>,
                    cancel: <?php echo json_encode(__('Close')) ?>
                });
            }
        }, 'json');
}

function contact_dialog_close()
{
    w4u.View.anchor(null);
    if (contact_dialog) {
        contact_dialog.remove();
        contact_dialog = null;
    }
}

function contactUs(el)
{
    w4u.View.anchor(el);
    contact_dialog = new fss.Dialog({
        title: <?php echo json_encode(__('Contact the Developer')) ?>,
        content: $('#contact_dialog'),
        confirm: <?php echo json_encode(__('Send')) ?>,
        cancel: <?php echo json_encode(__('Cancel')) ?>,
        closeOnConfirm: false,
        onconfirm: contact_dialog_submit,
        oncancel: contact_dialog_close,
        unique: true,
        width: 467
    });
}
-->
</script>
<div id="contact_dialog" style="display: none">
<?php include_partial('default/contact_form') ?>
</div>
